import 'package:flutter/material.dart';
import 'package:get/get_state_manager/get_state_manager.dart';
import 'package:hotfil_pub_web/controllers/count_coutroller.dart';
import 'package:get/get.dart';

class MessagePage extends StatelessWidget {
  CountController countController = Get.put(CountController());
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text('消息'),
        ),
        body: Container(
          child: Column(
            children: [
              ElevatedButton(
                  onPressed: () {
                    countController.increment();
                  },
                  child: Text('+')),
              GetBuilder<CountController>(
                  init: countController, builder: (_) => Text("${_.counter}")),
              ElevatedButton(
                  onPressed: () {
                    countController.reduce();
                  },
                  child: Text('-')),
            ],
          ),
        ));
  }
}


/**
 *  GetBuilder<CountController>(
            init: CountController(),
            builder: (_) {
              return Container(
                child: Column(
                  children: [
                    ElevatedButton(
                        onPressed: () {
                          _.increment();
                        },
                        child: Text('+')),
                    Text(_.counter.toString()),
                    ElevatedButton(
                        onPressed: () {
                          _.reduce();
                        },
                        child: Text('-')),
                  ],
                ),
              );
            })
 */
